UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3r1ghXDVff+RY08TtqSWWH9qpoVHJK7/yJiokCV3E80='
WHERE
key_id = '0b1d6b1a96274211a39cc86126115b4017361674fb54e63888f36e417c562b1e'
AND (
token = '3r1ghXDVff+RY08TtqSWWH9qpoVHJK7/yJiokCV3E80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)