UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p/0oNiEirTuEp+NBRkiJ9CCE9RUatwqa3UFQ4CyTJzA='
WHERE
key_id = '8505f586f9baa8eb71ae3367f81636c10fae567f9e7e244d33dd6088eb49404a'
AND (
token = 'p/0oNiEirTuEp+NBRkiJ9CCE9RUatwqa3UFQ4CyTJzA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)