UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1vcTLplw1tCWUIhpbwSQgVszi5mUIKMwBCoZWUK8Cpg='
WHERE
key_id = '5578f43f4c79f49d0eaf05318f5e5a6b7abf01356d8c35477cdf63ea83dad78b'
AND (
token = '1vcTLplw1tCWUIhpbwSQgVszi5mUIKMwBCoZWUK8Cpg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)