UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fhfrudNNpKiTaFdXSBh+JkdGDNSUNLiTztBmSV3K2vk=' 
WHERE 
  key_id = '9913c81a3090d7c842b63158c0368749a5baf0212bfdf9dfb3033994e7285172' 
  AND (
    token = 'fhfrudNNpKiTaFdXSBh+JkdGDNSUNLiTztBmSV3K2vk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076