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