UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uga/bH6aWFszeau7lc0mabus08MpQ7LrCxB2tH80X8s=' 
WHERE 
  key_id = '494d8ec5c042948857162902ebbee172c0f32dbb6a85fed22a0b617859766741' 
  AND (
    token = 'Uga/bH6aWFszeau7lc0mabus08MpQ7LrCxB2tH80X8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030