UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uQbSbmy1vxrTwpckC1NWOaFcyZkE9mfXrzbIgIWv38A=' 
WHERE 
  key_id = '11c91365bbb88c09074b239e07f6fdd47597be790e93d682b1428e28d46fca23' 
  AND (
    token = 'uQbSbmy1vxrTwpckC1NWOaFcyZkE9mfXrzbIgIWv38A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035