UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q5LbCeNHbQmyJhQsl78+jRzeaa0rHW1lvxkvn2hzQ+k=' 
WHERE 
  key_id = 'd51bf2f7166084211b7f66311b0765c72290a86bc608f89061a5b772266db3f9' 
  AND (
    token = 'Q5LbCeNHbQmyJhQsl78+jRzeaa0rHW1lvxkvn2hzQ+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033