UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+MCocfA5qWZMPVyG9XCiO9UdGxPULAaemjBEtHi6XWs=' 
WHERE 
  key_id = '164377b2cf786e882efcc7daac3e09e45775004bdab0b2464e16c14656b7197c' 
  AND (
    token = '+MCocfA5qWZMPVyG9XCiO9UdGxPULAaemjBEtHi6XWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032