UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CPAuVeBBqB2rb+lzESm09WHbSZpCZAWNJBMDRiFi9Io=' 
WHERE 
  key_id = 'a8f85cd7073ac0727ac4e6ff4b275fad15421c235dce2293f8541f863b468571' 
  AND (
    token = 'CPAuVeBBqB2rb+lzESm09WHbSZpCZAWNJBMDRiFi9Io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058