UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4m18X4GYiRKUc1VlygoCyFvzytQeU6v0zuGyh+obvG0=' 
WHERE 
  key_id = 'dc0eea1f08076f7aaedd842df3dbd40526a20539caede01f3eac452098c2edad' 
  AND (
    token = '4m18X4GYiRKUc1VlygoCyFvzytQeU6v0zuGyh+obvG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051