UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EiJV3xtUyWAzisXZgYHkUkK7zyPTXuaqIG4yyqcXmho='
WHERE
key_id = 'f71e8350ebf3b255fcf909ce56907b522e7eb2473e60a3f3b6450588e51d1438'
AND (
token = 'EiJV3xtUyWAzisXZgYHkUkK7zyPTXuaqIG4yyqcXmho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)