UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kIEVk/10Otz9kvMRUVyKOicgG8JaUuYGsfcHk7fLdEY='
WHERE
key_id = '123b258b3b2d11008a72efed51a3ef2d42e077a147ce05b613817436da0f4894'
AND (
token = 'kIEVk/10Otz9kvMRUVyKOicgG8JaUuYGsfcHk7fLdEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)