UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JXywwC4MMygLzt4oVGDYPvkmICS6xKRKn4ii+LLJPNY=' 
WHERE 
  key_id = 'dd3633eb85e3afbd19a0d4224e4f37f495b72ae75fe30c6ecfe627e6f8379440' 
  AND (
    token = 'JXywwC4MMygLzt4oVGDYPvkmICS6xKRKn4ii+LLJPNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018