UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E/CO4wrJkp16kBwGaOW9fnJTljgteiW3mm7ydFrmEj4='
WHERE
key_id = '387d5c2ceb2f04c3f798df63b19f5c6b8ff3e48b44eee0e9cf7f434f755e0e0d'
AND (
token = 'E/CO4wrJkp16kBwGaOW9fnJTljgteiW3mm7ydFrmEj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)