UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JsX1w4g99DWQGKlRU2pPci6cU+2sy/QZbIddp+j92Wo='
WHERE
key_id = 'e3d92091f3c3b1ddf412741629c16235829e603d15575528aa3f90550b9dad1b'
AND (
token = 'JsX1w4g99DWQGKlRU2pPci6cU+2sy/QZbIddp+j92Wo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)