UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IpAk7+eZOSqogYv6vhDuEihiZ32x3EXmM6mRFYSD0Q0='
WHERE
key_id = 'd8484af7a1b1244824220dd1135ac3b030769965368a495dea935df2dc4a1ead'
AND (
token = 'IpAk7+eZOSqogYv6vhDuEihiZ32x3EXmM6mRFYSD0Q0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)