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