UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rDaRtQORCFdc8Vnw/6b+HP+y/69l1ybGnm0t/tk+/eQ=' 
WHERE 
  key_id = '63405c227bb75f8c6c31f9ab505d0aeadd81711f2a085b6d75098054b1610799' 
  AND (
    token = 'rDaRtQORCFdc8Vnw/6b+HP+y/69l1ybGnm0t/tk+/eQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034