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

Query time 0.00040