UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PN/K2aUc0wmqaKN5nf6iiffFHQnR0XTqMNy6nDtMXQM=' 
WHERE 
  key_id = '163bfc0c95d1e6a0226f4126444027961317681e545d11fbf3827fa9473118b0' 
  AND (
    token = 'PN/K2aUc0wmqaKN5nf6iiffFHQnR0XTqMNy6nDtMXQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023