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

Query time 0.00058