UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '18HpufX40LgzzvrzgfJd59ez9ZMCY+6RMQjI09H+2zc='
WHERE
key_id = 'b706db85f2b7197333b46769725a1de54f599fe8e735595810371a099da2ed8a'
AND (
token = '18HpufX40LgzzvrzgfJd59ez9ZMCY+6RMQjI09H+2zc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)