UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I48jAe4ZSyKmkvyKn8X5PdOd8bm3ub91vrVm4HN+T5s=' 
WHERE 
  key_id = '1f47f29e8c6bf9d39ced5a625e48364ce703a29f464fc067b7d561313ebf349d' 
  AND (
    token = 'I48jAe4ZSyKmkvyKn8X5PdOd8bm3ub91vrVm4HN+T5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039