UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kk9OBL3RItRiq4q16bwhaBEhdD2Y9buqBOX76vdFNvM='
WHERE
key_id = '4f751608c34fd73e284e92cf637aed78d776525892e39d1eb175d87aae0c7d5f'
AND (
token = 'kk9OBL3RItRiq4q16bwhaBEhdD2Y9buqBOX76vdFNvM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)