UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N/h8yO6D/I6mf+5R0ZoJKcZ0fBEf62BsBHO258ecJZk=' 
WHERE 
  key_id = 'a6ab6192bc1660647e73a7582517be84f826f94022329680fde8f259eef591ca' 
  AND (
    token = 'N/h8yO6D/I6mf+5R0ZoJKcZ0fBEf62BsBHO258ecJZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029