UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uzVKKI+cprPaQ78yLwky9MXthWKdajuDUOPFRf8Kps0='
WHERE
key_id = '1c03012e338e5838fd6e530af5900ad1cea179106785439d9a982221a4fe78e4'
AND (
token = 'uzVKKI+cprPaQ78yLwky9MXthWKdajuDUOPFRf8Kps0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)